package com.sun.dailyprj.androidx.recyclerview.base;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.sun.dailyprj.R;
import com.sun.dailyprj.databinding.ActivityWorkerRecycleBinding;

/*
 * =====================================================================================
 * Summary:
 *
 * File: RecyclerWorkerActivity.java
 * Author: Yanpeng.Sun
 * Create: 2019/9/26 17:12
 * =====================================================================================
 */
public class RecyclerWorkerActivity extends AppCompatActivity{
    ActivityWorkerRecycleBinding mBinding;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mBinding = DataBindingUtil.setContentView(this, R.layout.activity_worker_recycle);

        RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rv_detail);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));

        WorkerAdapter adapter = new WorkerAdapter(this);
        recyclerView.setAdapter(adapter);
        adapter.getItems().add(new Worker("张三", 18));
        adapter.getItems().add(new Worker("李四", 28));
        adapter.getItems().add(new Worker("王五", 38));
    }
}
